package com.ttg.web.dao.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.common.enums.ConditionsTypeEnum;
import com.ttg.model.mapper.ConditionsNameClassMapper;
import com.ttg.model.pojo.ConditionsNameClass;
import com.ttg.web.dao.ConditionsNameClassDao;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class ConditionsNameClassDaoImpl extends ServiceImpl<ConditionsNameClassMapper, ConditionsNameClass> implements ConditionsNameClassDao {

    @Override
    public List<ConditionsNameClass> getAllByStatusAndType(Integer type) {
        LambdaQueryWrapper<ConditionsNameClass> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ConditionsNameClass::getStatus, 0);
      //  if (!ConditionsTypeEnum.PUBLIC.getType().equals(type)) {
            queryWrapper.eq(ConditionsNameClass::getClassType, type);
       // }
        return list(queryWrapper);
    }

    @Override
    public List<ConditionsNameClass> getAllStatus0() {
        LambdaQueryWrapper<ConditionsNameClass> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ConditionsNameClass::getStatus, 0);
        return list(queryWrapper);
    }
}
